#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPainter>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , m_pMainForm(new MainForm)
    , m_pUploadForm(new UploadForm)
    , m_pAnswerForm(new AnswerForm)
{
    ui->setupUi(this);

    connect(m_pMainForm, &MainForm::switchSig, [&](int i){
        clearLayout(ui->gridLayout);
        if(i == 0)
            ui->gridLayout->addWidget(m_pUploadForm);
        else
        {
            ui->gridLayout->addWidget(m_pAnswerForm);
            m_pAnswerForm->Init();
        }
        ui->pushButton->setHidden(false);
    });
    on_pushButton_clicked();
    setMinimumSize(1400, 1000);

 }

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    clearLayout(ui->gridLayout);
    ui->gridLayout->addWidget(m_pMainForm);
    ui->pushButton->hide();
}

//void MainWindow::paintEvent(QPaintEvent *)
//{
    /*QPixmap image2;
    image2.load(":/new/prefix1/images/test.jpg");
    QPainter painter(this);
    painter.drawPixmap(0,0,950,700,image2);*/
//}

